package hu.jonas.junitmax.handlers;

import hu.jonas.junitmax.TestResultViewPart;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;

public class FilterPassedTests extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		
		TestResultViewPart testResultView =
			(TestResultViewPart) window.getActivePage().findView(TestResultViewPart.VIEWPART_ID);

		testResultView.setPassedTestFilter(true);
		
		return null;
	}

}
